class Solution:
    def minOperations(self, s: str) -> int:
        first = s[0]
        second = '0'
        next = first
        if next == '0':
            second = '1'
        else:
            second = '0'
        sum = 0
        for dix ,val  in enumerate(s):
           if val != next:
               sum += 1
           if dix %2 == 0:
               next = second
           else:
               next = s[0]
        return min(sum,len(s)-sum)








if __name__ == '__main__':
    s = "10010100"
    solution = Solution()
    val= solution.minOperations(s)
    print(val)